Spanish updates from Alberto Nu~nez
[adiumx.git] / Plugins / Purple Service / ESPurpleNovellAccount.m
blobb3c239508966b882f02e7edf72b030cfda2e258e
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import <Adium/AIAccountControllerProtocol.h>
18 #import <Adium/AIStatusControllerProtocol.h>
19 #import "ESPurpleNovellAccount.h"
20 #import <Adium/AIStatus.h>
22 @implementation ESPurpleNovellAccount
24 gboolean purple_init_novell_plugin(void);
25 - (const char*)protocolPlugin
27     return "prpl-novell";
30 #pragma mark Status
31 - (NSString *)connectionStringForStep:(int)step
33         switch (step)
34         {
35                 case 1:
36                         return AILocalizedString(@"Connecting",nil);
37                         break;
38                 case 2:
39                         return AILocalizedString(@"Authenticating",nil);
40                         break;
41                 case 3:
42                         return AILocalizedString(@"Waiting for Response",nil);
43                         break;                  
44         }
45         
46         return nil;
50 /*!
51  * @brief Return the purple status ID to be used for a status
52  *
53  * Most subclasses should override this method; these generic values may be appropriate for others.
54  *
55  * Active services provided nonlocalized status names.  An AIStatus is passed to this method along with a pointer
56  * to the status message.  This method should handle any status whose statusNname this service set as well as any statusName
57  * defined in  AIStatusController.h (which will correspond to the services handled by Adium by default).
58  * It should also handle a status name not specified in either of these places with a sane default, most likely by loooking at
59  * [statusState statusType] for a general idea of the status's type.
60  *
61  * @param statusState The status for which to find the purple status ID
62  * @param arguments Prpl-specific arguments which will be passed with the state. Message is handled automatically.
63  *
64  * @result The purple status ID
65  */
66 - (const char *)purpleStatusIDForStatus:(AIStatus *)statusState
67                                                         arguments:(NSMutableDictionary *)arguments
69         const char              *statusID = NULL;
70         NSString                *statusName = [statusState statusName];
71         NSString                *statusMessageString = [statusState statusMessageString];
72         
73         if (!statusMessageString) statusMessageString = @"";
75         switch ([statusState statusType]) {
76                 case AIAvailableStatusType:
77                         break;
78                         
79                 case AIAwayStatusType:
80                         if (([statusName isEqualToString:STATUS_NAME_BUSY]) ||
81                                 ([statusMessageString caseInsensitiveCompare:[[adium statusController] localizedDescriptionForCoreStatusName:STATUS_NAME_BUSY]] == NSOrderedSame))
82                                 statusID = "busy";
83                         break;
85                 case AIInvisibleStatusType:
86                         statusID = "appearoffline";
87                         break;
89                 case AIOfflineStatusType:
90                         break;
91         }
93         //If we didn't get a purple status ID, request one from super
94         if (statusID == NULL) statusID = [super purpleStatusIDForStatus:statusState arguments:arguments];
95         
96         return statusID;
99 @end